home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
allowo1g
/
domtable.frm
< prev
next >
Wrap
Text File
|
1999-08-27
|
26KB
|
812 lines
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL"
Begin VB.Form frmDOMTable
Caption = "DOM Demo"
ClientHeight = 3885
ClientLeft = 60
ClientTop = 630
ClientWidth = 5940
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3885
ScaleWidth = 5940
WindowState = 2 'Maximized
Begin SHDocVwCtl.WebBrowser wbr
Height = 3675
Left = 120
TabIndex = 0
Top = 120
Width = 5715
ExtentX = 10081
ExtentY = 6482
ViewMode = 1
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = -1 'True
NoClientEdge = 0 'False
AlignLeft = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = ""
End
Begin VB.Menu mnuFileMenu
Caption = "&File"
Begin VB.Menu mnuFile
Caption = "&HTML"
Index = 0
End
Begin VB.Menu mnuFile
Caption = "&Recurse"
Index = 1
End
Begin VB.Menu mnuFile
Caption = "S&tructure"
Index = 2
End
Begin VB.Menu mnuFile
Caption = "St&yle"
Index = 3
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 4
End
Begin VB.Menu mnuFile
Caption = "Save &As..."
Index = 5
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 6
End
Begin VB.Menu mnuFile
Caption = "Page Set&up..."
Index = 7
End
Begin VB.Menu mnuFile
Caption = "&Print..."
Index = 8
End
Begin VB.Menu mnuFile
Caption = "-"
Index = 9
End
Begin VB.Menu mnuFile
Caption = "&Close"
Index = 10
End
End
Begin VB.Menu mnuDemoMenu
Caption = "Demo"
Begin VB.Menu mnuDemo
Caption = "Progress Display"
Index = 0
End
Begin VB.Menu mnuDemo
Caption = "Load Table"
Enabled = 0 'False
Index = 1
End
Begin VB.Menu mnuDemo
Caption = "Show Table"
Enabled = 0 'False
Index = 2
End
Begin VB.Menu mnuDemo
Caption = "Format"
Enabled = 0 'False
Index = 3
End
Begin VB.Menu mnuDemo
Caption = "-"
Index = 4
End
Begin VB.Menu mnuDemo
Caption = "All"
Index = 5
End
End
Begin VB.Menu mnuOptMenu
Caption = "&Options"
Begin VB.Menu mnuOpt
Caption = "&Format"
Index = 0
End
Begin VB.Menu mnuOpt
Caption = "&Background"
Index = 1
Begin VB.Menu mnuBGround
Caption = "&Blue binder"
Index = 1
End
Begin VB.Menu mnuBGround
Caption = "&Green binder"
Index = 2
End
End
Begin VB.Menu mnuOpt
Caption = "&Caption"
Index = 2
End
Begin VB.Menu mnuOpt
Caption = "-"
Index = 3
End
Begin VB.Menu mnuOpt
Caption = "Scroll Bar"
Index = 4
End
Begin VB.Menu mnuOpt
Caption = "-"
Index = 5
End
Begin VB.Menu mnuOpt
Caption = "Context Menu"
Index = 6
Begin VB.Menu mnuContext
Caption = "&Default"
Checked = -1 'True
Index = 0
End
Begin VB.Menu mnuContext
Caption = "&File"
Index = 1
End
Begin VB.Menu mnuContext
Caption = "&Options"
Index = 2
End
End
End
End
Attribute VB_Name = "frmDOMTable"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' DOMTable.frm July 1999 contact markb@orionstudios.com
' Demonstrates DOM manipulation from Vb6 including
' build document in empty WebBrowser Control
' build DIV element as progress display
' build a Stylesheet
' convert tab-deliited text to HTML Table with
' Header, Footer, Caption, Column definitions
' enable/disable formatting
' replace standard context (right-click) popup menu
' set document title, table caption
' saving constructed document as HTML
'
' Requires Project/References entry for
' Microsoft HTML Object Library (MSHTML.tlb)
'====================================================================================
'
' Module-level VARIABLES
'
Private mDefaultPath As String ' set in Form_Load
Private mDataFileSpec As String ' Name of tab-delimited data file
Private mvarMDIParent As MDIForm ' useful to access parent form - see StatusText
Private mDemoDoc As MSHTML.HTMLDocument ' = wbr.document (see wbr_DocumentComplete)
Private mDemoBody As MSHTML.HTMLBody ' = wbr.document.body
Private mTable As MSHTML.HTMLTable ' returned from mListToHTML.FileToDOM
Private mStyleSheet As MSHTML.HTMLStyleSheet ' returned from BuildStyleSheet
Private WithEvents mHTMLDocEvents As MSHTML.HTMLDocument ' captures right-click
Attribute mHTMLDocEvents.VB_VarHelpID = -1
Private WithEvents mListToHTML As ListToHTML ' converts mDataFileSpec to HTML
Attribute mListToHTML.VB_VarHelpID = -1
Private mContextOption As Long ' current context menu selection
' Module-level variables for Progress Display
Private mProgressDisplay As MSHTML.HTMLDivElement
Private mProgressRow As MSHTML.IHTMLDOMTextNode
Private mProgressBarStyle As MSHTML.HTMLStyle
Private WithEvents mProgressCancel As MSHTML.HTMLButtonElement ' Life cycle = mListToHTML
Attribute mProgressCancel.VB_VarHelpID = -1
Private mTotalRows As Long ' helps calculate percentage for progress Bar
'
' Module-level CONSTANTS
'
Private Const START_HTML = "<BODY style=overflow:auto></BODY>"
' File Menu Constants
Private Const FILE_HTML = 0
Private Const FILE_RECURSE = 1
Private Const FILE_STRUCTURE = 2
Private Const FILE_STYLE = 3
Private Const FILE_SAVEAS = 5
Private Const FILE_PAGESETUP = 7
Private Const FILE_PRINT = 8
Private Const FILE_CLOSE = 10
' Demo menu constants
Private Const DEMO_PROGRESS = 0
Private Const DEMO_LOAD = 1
Private Const DEMO_SHOW = 2
Private Const DEMO_FORMAT = 3
Private Const DEMO_ALL = 5
' Option menu constants
Private Const OPT_FORMAT = 0
Private Const OPT_BGROUND = 1
Private Const OPT_CAPTION = 2
Private Const OPT_SCROLL = 4
' Context menu constants
Private Const CTX_DEFAULT = 0
Private Const CTX_FILE = 1
Private Const CTX_OPT = 2
' Background menu constants
Private Const BG_BLUEBINDER = 1
Private Const BG_GREENBINDER = 2
' Module-level Constants
' Relevant nodeType constants
Private Const ELEMENT_NODE = 1
Private Const TEXT_NODE = 3
' Browser navigation constants
Private Const navNoHistory = 2
Public Property Let DataFileSpec(ByVal vData As String)
mDataFileSpec = vData
End Property
Public Property Set MDIParent(vData As MDIForm) ' optional
Set mvarMD